package jdbc2;

import java.sql.Connection;
import java.sql.Statement;

/*
* 根据id删除指定用户
* */
public class JDBCDemo4 {
    public static void main(String[] args) throws Exception {
        Connection conn = DBUtil.getConnection();
        Statement stmt = conn.createStatement();
        /*
        * 删除id为1的用户信息
        * DELETE FROM userinfo WHERE id=1;
        * */
        String sql = "DELETE FROM userinfo WHERE id=1;";
        int num = stmt.executeUpdate(sql);
        System.out.println(num > 0 ? "删除成功" : "删除失败");
        System.out.println(num);
        conn.close();
    }
}
